<template>
	<view>
		<scroll-view scroll-y="true" :style="'height:'+scrollH+'px;'" @scrolltolower="loadMore()">
		<block v-for="(item,index) in list" :key='index'>
		<view class=" align-center justify-center border my-2 p-3">
		 <view class="text-light-muted font-md" >时间:{{item.createTime}}</view>
		 <view class="flex text-wrapper">{{item.content}}</view>
		</view>
	   </block>
	    <load-more :loadmore="loadmore"></load-more>
		
	</scroll-view>
	</view>
</template>

<script>
	import loadMore from '@/components/common/load-more.vue';
	export default {
		components:{loadMore},
		data() {
			return {
			scrollH:300,
			loadmore:'上拉加载更多',
			pagnation:{
				pageNum:1,
				pageSize:10
			},
			 list:[] 
			}
		},
		onLoad() {
		uni.getSystemInfo({
			success: (res) => {
				this.scrollH = res.windowHeight;
			}
		}),
		this.getData()
			
		},
		methods: {
			loadMore(){
				if(this.loadmore !== "上拉加载更多") return;
				this.loadmore ="加载中..."
				this.pagnation.pageNum++
				this.getData();
			  
			},
			getData(){
				const data={
				    ...this.pagnation
				}
				let temp = this.list;
				this.$R.get("/meet/event/message/list",data).then(res=>{
					if(res.code == 200)
					{
						this.list = this.pagnation.pageNum==1?res.rows:[...res.rows,...temp],
						this.loadmore = res.rows.length<10?'没有更多了':'上拉加载更多'
					}
				})
			}
		}
	}
</script>

<style>

</style>
